package redis

import (
	"FeedXmh/app/model"
	"fmt"
	"github.com/gogf/gf/frame/g"
	"github.com/gogf/gf/util/gconv"
)

// GetHouseSummary 获取栏舍汇总状态
func GetHouseSummary(houseid string) (str string) {
	val, err := g.Redis("default").Do("get", fmt.Sprintf("%s:house:%s:summary", model.Redis_Node_Prefix, houseid))
	if err != nil {
		g.Log().Line(true).Error(err)
	} else {
		if val == nil {
			str = ""
		} else {
			str = gconv.String(val)
		}
	}
	return str
}

// SetHouseSummary 设置栏舍汇总状态
func SetHouseSummary(houseid string, str string) {
	_, err := g.Redis("default").Do("set", fmt.Sprintf("%s:house:%s:summary", model.Redis_Node_Prefix, houseid), str)
	if err != nil {
		g.Log().Line(true).Error(err)
	} else {
		g.Log().Line(true).Debugf("Redis set %s:house:%s:summary ok", model.Redis_Node_Prefix, houseid)
	}
}
